/**
  author : sailing
  date : 2016-10-21
  fun: button
***/

<style lang="less">
  .vx-panel-tip{
      min-width:100px;
      background:#f7f7f7;
      z-index:8000;
      top:80px;
      padding:0 10px 0 10px;
      min-height:30px;
      line-height:30px;
      box-shadow: 1px 2px 2px #ccc;
      border-radius:10px;
      position:absolute;
      
  }
</style>

<template>

  <transition name="fadeIn">
  <div v-show="isShow">
    <div class="vx-panel-tip" v-show="isShow" v-bind:style="{left: left + 'px', top: top + 'px'}">
      <ul>
        <li v-if="showLabel === 'label'">
          <label>设备名称:</label>{{label}}<span></span>
        </li>
        <li v-else>
          <label>设备IP:</label><span>{{IP}}</span>
        </li>
        <li>
          <label>所在机柜:</label><span>{{cabinet}}</span>
        </li>
        <li>
          <label>起始位置:</label><span>{{pos}}</span>
        </li>
        <li>
          <label>所在机房:</label><span>{{room}}</span>
        </li>
        <li>
          <label>设备类型:</label><span>{{equip_type}}</span>
        </li>
      </ul>
    </div>
  </div>
  </transition>
</template>

<script>
import eventBus from '../../eventBus'
import dataC from '../../server/data'
export default {
  data () {
    return {
      isShow: false,
      showLabel: 'label',
      left: 10,
      top: 400,
      label: '',
      cabinet: '',
      pos: '',
      room: '',
      IP: '',
      equip_type: '',
      list: { 
      },
      radio: ''
    }  
  },
  methods: {
  },
  mounted () {
    const that = this
    eventBus.bus.$on('mouseMove', function (param) { 
      var e = param.event
      that.left = e.pageX + 5
      that.top = e.pageY + 5 
    })

    eventBus.bus.$on('showHideNodeTip', function (param) {
      that.isShow = param.show
      try {
        var data = param.vm.data()
        that.cabinet = data.cabinet
        that.label = data.label
        that.room = data.room
        that.pos = data.pos
        that.IP = data.ip
        that.equip_type = data.equip_type
        if (dataC.labelIp === 'label') {
          data.ip ? that.showLabel = 'IP' : that.showLabel = 'label'
        } else {
          data.label ? that.showLabel = 'label' : that.showLabel = 'ip'
        }
      } catch (e) {
      }
    })
  },
  props: {
    bg: String,
    text: String
  },
  components: {}
}
</script>